<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>东财个股资金流</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">				
			p {margin:0px;}					
			ul {margin:0px;}			
			h4 {margin:0px}	
			
			.fixedBox{					
				white-space: nowrap;	
			}
			.fixedBox::-webkit-scrollbar {
				width: 8px;     
				height: 8px;				
			}			
		</style>		
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		
		<script>			
			window.onload = function() {				
				getSource();
				changeStyle();
			}
			
			
			$(function() {
				setInterval(function() {									
					getSource();																				
				},
				500);
			})
			
			function changeStyle() {				
				var obj = document.getElementById("towrite");
				obj.style.left= "0px"; 
				obj.style.width= "300px";
				obj.style.height= "500px";
				obj.style.fontSize ="12px";
				obj.style.marginTop= "-10px";
				obj.style.marginLeft = "2px";  					
			}			
						
			var gpdm = "";
			var gpmc = "";				
			function getSource() {	    
				var u = decodeURI(window.location.href);				
				
				if(u.indexOf("##") > -1){
					var gp = u.split('##');				
					dm = gp[1];
					gpmc = gp[2];															
				}else{
					dm = "600000";
					gpmc = "浦发银行";					
				}
				
				if(dm != gpdm){					
					gpdm = dm;					
					var dms = "";
					var dmt = "";
					if(dm.substr(0,1)=="6"){
						dms = "SH" + dm;
						dmt = "1." + dm;
					}else{
						dms = "SZ" + dm;
						dmt = "0." + dm;
					}
					
					var url = "http://push2.eastmoney.com/api/qt/ulist.np/get?cb=jQuery1123022062381139471432_1633842668576&fltt=2&secids=" + dmt +"&fields=f62,f184,f66,f69,f72,f75,f78,f81,f84,f87,f164,f165,f166,f167,f168,f169,f170,f171,f172,f173";											
					if (window.XMLHttpRequest) {
						xmlHttp = new XMLHttpRequest();
					} else {					
						xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					}					
					xmlHttp.onreadystatechange = writeSource;
					xmlHttp.open("GET", url, true);
					xmlHttp.send(null);					
				}
			}
			
			function writeSource() { 
				if (xmlHttp.readyState == 4) { 						
					var data1 = xmlHttp.responseText	
					//document.write(data1);
										
					var zljlr = data1.match(/"f62":(\S*),"f66/)[1];
					var zljb = data1.match(/"f184":(\S*)}]}/)[1];					
					var cddjlr = data1.match(/"f66":(\S*),"f69/)[1];
					var cddjb = data1.match(/"f69":(\S*),"f72/)[1];					
					var ddjlr = data1.match(/"f72":(\S*),"f75/)[1];
					var ddjb = data1.match(/"f75":(\S*),"f78/)[1];					
					var zdjlr = data1.match(/"f78":(\S*),"f81/)[1];
					var zdjb = data1.match(/"f81":(\S*),"f84/)[1];					
					var xdjlr = data1.match(/"f84":(\S*),"f87/)[1];
					var xdjb = data1.match(/"f87":(\S*),"f164/)[1];
					
					var zljlr5 = data1.match(/"f164":(\S*),"f165/)[1];
					var zljb5 = data1.match(/"f165":(\S*),"f166/)[1];					
					var cddjlr5 = data1.match(/"f166":(\S*),"f167/)[1];
					var cddjb5 = data1.match(/"f167":(\S*),"f168/)[1];					
					var ddjlr5 = data1.match(/"f168":(\S*),"f169/)[1];
					var ddjb5 = data1.match(/"f169":(\S*),"f170/)[1];					
					var zdjlr5 = data1.match(/"f170":(\S*),"f171/)[1];
					var zdjb5 = data1.match(/"f171":(\S*),"f172/)[1];					
					var xdjlr5 = data1.match(/"f172":(\S*),"f173/)[1];
					var xdjb5 = data1.match(/"f173":(\S*),"f184/)[1];
					
					var html = "<p>今日主力净流入：<span>" + NumberTransform(zljlr) + "</span>&nbsp;&nbsp;主力净比：<span>" + zljb + "%</span></p>" +					
					"<p>今日超大单净流入：<span>" + NumberTransform(cddjlr) + "</span>&nbsp;&nbsp;超大单净比：<span>" + cddjb +  "%</span></p>" + 
					"<p>今日大单净流入：<span>" + NumberTransform(ddjlr) + "</span>&nbsp;&nbsp;大单净比：<span>" + ddjb +  "%</span></p>" + 
					"<p>今日中单净流入：<span>" + NumberTransform(zdjlr) + "</span>&nbsp;&nbsp;中单净比：<span>" + zdjb +  "%</span></p>" + 
					"<p>今日小单净流入：<span>" + NumberTransform(xdjlr) + "</span>&nbsp;&nbsp;小单净比：<span>" + xdjb +  "%</span></p>" + 
					
					"<br><p>5日主力净流入：<span>" + NumberTransform(zljlr5) + "</span>&nbsp;&nbsp;主力净比：<span>" + zljb5 + "%</span></p>" +					
					"<p>5日超大单净流入：<span>" + NumberTransform(cddjlr5) + "</span>&nbsp;&nbsp;超大单净比：<span>" + cddjb5 +  "%</span></p>" + 
					"<p>5日大单净流入：<span>" + NumberTransform(ddjlr5) + "</span>&nbsp;&nbsp;大单净比：<span>" + ddjb5 +  "%</span></p>" + 
					"<p>5日中单净流入：<span>" + NumberTransform(zdjlr5) + "</span>&nbsp;&nbsp;中单净比：<span>" + zdjb5 +  "%</span></p>" + 
					"<p>5日小单净流入：<span>" + NumberTransform(xdjlr5) + "</span>&nbsp;&nbsp;小单净比：<span>" + xdjb5 +  "%</span></p>";
					//var zjwz = "<a href='https://data.eastmoney.com/zjlx/" + gpdm + ".html' target='_blank'>网址</a>";
					var zjwz = "<a href='http://www.treeid/dlghttps://data.eastmoney.com/zjlx/xxxxxx.html' style='color:#FF00FF'>网址</a>";
					//div.innerHTML = div.innerHTML +  '<br><h4>东方财富个股资金流向：</h4>' + html;
					var div = document.getElementById('towrite');
					div.innerHTML = "<h4>" + gpdm + "&nbsp;&nbsp;&nbsp;" + gpmc + "</h4>";
					div.innerHTML += "<font size='3'>东方财富个股资金流向：<font size='1'>" + "&nbsp;&nbsp;&nbsp;&nbsp;" + zjwz + "</font></font>" + html;					
					change();				
				}			
			}
			
			function NumberTransform(num) { 
				var result = num;
               if(Math.abs(num) > 100000000){
			    result = num / 100000000;
				result = result.toFixed(2) + "亿";
			   }else if(Math.abs(num) > 10000){
			    result = num/10000;
				result = result.toFixed(2) + "万";
			   }				   
               return result;  
			};	
			
			function change() {
				var div = document.getElementById('towrite');
				var items = div.getElementsByTagName("span"); 
				for ( var i = 0; i < items.length; i++)
				{
					var obj = items[i];
					var num = parseFloat (obj.firstChild.nodeValue);
					//obj.style.color = num > 0 ? "Orange" : "Lime";					
					obj.style.color = num > 0 ? "Orange" : (num < 0 ? "Lime" : "#d2d2d3");					
				}							
			};
			
		</script>
	</head>
	<body>
		<div id="towrite" class="fixedBox"></div>	
	</body>
</html>